/*
 * ConfirmUserInfo.java
 *
 * Created on __DATE__, __TIME__
 */

package com.shangpintechnology.sci.machinegenerat;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import javax.swing.JPanel;

import com.shangpintechnology.sci.cam.MainFrame;

/**
 *
 * @author  __USER__
 */
public class ConfirmUserInfo extends javax.swing.JDialog {

	/** Creates new form ConfirmUserInfo */
	public ConfirmUserInfo(java.awt.Frame parent, boolean modal) {
		super(parent, modal);
		initComponents();
	}

	public javax.swing.JTextField getAge() {
		return age;
	}

	public void setAge(javax.swing.JTextField age) {
		this.age = age;
	}

	public javax.swing.JTextField getBankCard() {
		return bankCard;
	}

	public void setBankCard(javax.swing.JTextField bankCard) {
		this.bankCard = bankCard;
	}

	public javax.swing.JButton getCancel() {
		return cancel;
	}

	public void setCancel(javax.swing.JButton cancel) {
		this.cancel = cancel;
	}

	public javax.swing.JButton getConfirm() {
		return confirm;
	}

	public void setConfirm(javax.swing.JButton confirm) {
		this.confirm = confirm;
	}

	public ImagePanel getImage() {
		return image;
	}

	public void setImage(ImagePanel image) {
		this.image = image;
	}

	public javax.swing.JTextField getUserName() {
		return name;
	}

	public void setName(javax.swing.JTextField name) {
		this.name = name;
	}

	public javax.swing.JTextField getPassCode() {
		return passCode;
	}

	public void setPassCode(javax.swing.JTextField passCode) {
		this.passCode = passCode;
	}

	public javax.swing.JTextField getPassType() {
		return passType;
	}

	public void setPassType(javax.swing.JTextField passType) {
		this.passType = passType;
	}

	public javax.swing.JTextField getRfidCard() {
		return rfidCard;
	}

	public void setRfidCard(javax.swing.JTextField rfidCard) {
		this.rfidCard = rfidCard;
	}

	public javax.swing.JTextField getRiskStage() {
		return riskStage;
	}

	public void setRiskStage(javax.swing.JTextField riskStage) {
		this.riskStage = riskStage;
	}

	public javax.swing.JTextField getSex() {
		return sex;
	}

	public void setSex(javax.swing.JTextField sex) {
		this.sex = sex;
	}

	public javax.swing.JTextField getVipCard() {
		return vipCard;
	}

	public void setVipCard(javax.swing.JTextField vipCard) {
		this.vipCard = vipCard;
	}

	public javax.swing.JTextField getVipLevel() {
		return vipLevel;
	}

	public void setVipLevel(javax.swing.JTextField vipLevel) {
		this.vipLevel = vipLevel;
	}

//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

image = new ImagePanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
name = new javax.swing.JTextField();
age = new javax.swing.JTextField();
sex = new javax.swing.JTextField();
riskStage = new javax.swing.JTextField();
passType = new javax.swing.JTextField();
passCode = new javax.swing.JTextField();
vipCard = new javax.swing.JTextField();
rfidCard = new javax.swing.JTextField();
bankCard = new javax.swing.JTextField();
vipLevel = new javax.swing.JTextField();
confirm = new javax.swing.JButton();
cancel = new javax.swing.JButton();
changeRfid = new javax.swing.JButton();
getCam = new javax.swing.JButton();
camText = new javax.swing.JPanel();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setLocationByPlatform(true);

//image.setText("\u70b9\u51fb\u8fd9\u91cc\u65b0\u589e\u7167\u7247");

jLabel2.setText("VIP\u5361\u53f7");

jLabel3.setText("RFID\u5361\u53f7");

jLabel4.setText("\u94f6\u884c\u5361\u53f7");

jLabel5.setText("VIP\u7ea7\u522b");

jLabel6.setText("\u59d3\u540d");

jLabel7.setText("\u5e74\u9f84");

jLabel8.setText("\u6027\u522b");

jLabel9.setText("\u98ce\u9669\u7b49\u7ea7");

jLabel10.setText("\u8bc1\u4ef6\u7c7b\u578b");

jLabel11.setText("\u8bc1\u4ef6\u53f7\u7801");

name.setText(" ");

age.setText(" ");

sex.setText(" ");
sex.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sexActionPerformed(evt);
}
});

riskStage.setText(" ");

passType.setText(" ");
passType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
passTypeActionPerformed(evt);
}
});

passCode.setText(" ");

org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(27, 27, 27)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel7)
.add(jLabel8))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(sex)
.add(age)
.add(name, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))
.add(89, 89, 89)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel11)
.add(18, 18, 18)
.add(passCode))
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel10)
.add(18, 18, 18)
.add(passType))
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel9)
.add(18, 18, 18)
.add(riskStage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 91, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(23, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(22, 22, 22)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel6)
.add(jLabel9)
.add(name, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(riskStage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(18, 18, 18)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel7)
.add(jLabel10)
.add(age, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(passType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(18, 18, 18)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel8)
.add(jLabel11)
.add(sex, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(passCode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap(26, Short.MAX_VALUE))
);

vipCard.setText("\u7cfb\u7edf\u751f\u6210");
vipCard.setEditable(false);

rfidCard.setText("\u8bf7\u5c06\u5361\u7247\u7f6e\u4e8e\u5929\u7ebf\u4e8c\u9644\u8fd1");
rfidCard.setEditable(false);

vipLevel.setText(" ");
vipLevel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
vipLevelActionPerformed(evt);
}
});

confirm.setText("\u63d0\u4ea4");

cancel.setText("\u53d6\u6d88");
this.setVisible(false);

changeRfid.setText("\u6362\u5361");

getCam.setText("\u62cd\u7167");
//得到拍照事件
//final ImagePanel image = null;
getCam.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
	image.add(MainFrame.getMainFrame().recordButtonActionPerformed(evt));
}
});
org.jdesktop.layout.GroupLayout camTextLayout = new org.jdesktop.layout.GroupLayout(camText);
//camText.setLayout(camTextLayout);
MainFrame mainFrame = new MainFrame();
/*mainFrame.initCam();
camText.add(MainFrame.getMainFrame().getNorthPanel());
camTextLayout.setHorizontalGroup(
camTextLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 336, Short.MAX_VALUE)
);
camTextLayout.setVerticalGroup(
camTextLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 202, Short.MAX_VALUE)
);
*/
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(251, 251, 251)
.add(confirm)
.add(36, 36, 36)
.add(changeRfid)
.add(61, 61, 61)
.add(cancel)
.addContainerGap(508, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(125, 125, 125)
.add(image, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(getCam)
.add(48, 48, 48)
.add(camText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(29, 29, 29))
.add(layout.createSequentialGroup()
.add(33, 33, 33)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel2)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel4)
.add(jLabel3)
.add(jLabel5))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)))
.add(10, 10, 10)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(vipLevel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
.add(bankCard, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
.add(rfidCard, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, vipCard, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE))
.add(122, 122, 122)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(178, 178, 178))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(image, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createSequentialGroup()
.add(63, 63, 63)
.add(getCam))
.add(camText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(37, 37, 37)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(vipCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(rfidCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel3))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(bankCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel5)
.add(vipLevel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(layout.createSequentialGroup()
.add(28, 28, 28)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(cancel)
.add(changeRfid)
.add(confirm))))
.addContainerGap(55, Short.MAX_VALUE))
);

pack();
}// </editor-fold>
//GEN-END:initComponents
private void getCamActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}


	private void passTypeActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void sexActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void vipLevelActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				ConfirmUserInfo dialog = new ConfirmUserInfo(
						new javax.swing.JFrame(), true);
				dialog.addWindowListener(new java.awt.event.WindowAdapter() {
					public void windowClosing(java.awt.event.WindowEvent e) {
						System.exit(0);
					}
				});

				dialog.setVisible(true);
			}
		});
	}	

//GEN-BEGIN:variaes
// Variables declaration - do not mofy
private javax.swing.JTextField age;
private javax.swing.JTextField bankCard;
private javax.swing.JButton cancel;
private javax.swing.JButton changeRfid;
private javax.swing.JButton confirm;
private javax.swing.JButton getCam;
private javax.swing.JPanel camText;
public javax.swing.JPanel getCamText() {
	return camText;
}

public void setCamText(javax.swing.JPanel camText) {
	this.camText = camText;
}

private ImagePanel image;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField name;
private javax.swing.JTextField passCode;
private javax.swing.JTextField passType;
private javax.swing.JTextField rfidCard;
private javax.swing.JTextField riskStage;
private javax.swing.JTextField sex;
private javax.swing.JTextField vipCard;
private javax.swing.JTextField vipLevel;
// End of variables declaration//GEN-END:variables
/**
 * 
 * 拍照完成后显示照片的组件，可以拖动范围框，选择要截取的部分
 */
private int imgWidth = 500;

private int imgHeight = 500;
private int rectWidth = 200;

private int rectHeight = 200;
private int rectX;

private int rectY;
class ImagePanel extends Panel implements MouseMotionListener {
	private static final long serialVersionUID = -7758515478075258357L;
	private Image myimg = null;

	public ImagePanel() {
		setLayout(null);
		setSize(imgWidth, imgHeight);
	}

	public void setImage(Image img) {
		this.myimg = img;
		repaint();
	}

	public void update(Graphics g) {
		g.clearRect(0, 0, getWidth(), getHeight());
		if (myimg != null) {
			g.drawImage(myimg, 0, 0, this);
			g.setColor(Color.RED);
			g.drawRect(rectX, rectY, rectWidth, rectHeight);
		}
	}

	public void paint(Graphics g) {
		update(g);
	}

	public void mouseDragged(MouseEvent e) {
		rectX = e.getX() - 50;
		rectY = e.getY() - 50;
		repaint();
	}

	public void mouseMoved(MouseEvent e) {
	}
}
}